﻿@page "/{CompanyId}/Designer/{WorkflowDefinitionId}"
@model DesignerModel
@{
    ViewData["Title"] = "Elsa Studio";
}

@section Head {
    <link rel="manifest" href="_content/Elsa.Studio.Shell/site.webmanifest">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
    <link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Grandstander:wght@100&display=swap" rel="stylesheet">
    <link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
    <link href="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.css" rel="stylesheet" />
    <link href="_content/Radzen.Blazor/css/material-base.css" rel="stylesheet" >
    <link href="_content/Elsa.Studio.Shell/css/shell.css" rel="stylesheet">
    <link href="Elsa.Studio.Host.CustomElements.styles.css" rel="stylesheet">
}
@section Scripts {
    <script src="_content/BlazorMonaco/jsInterop.js"></script>
    <script src="_content/BlazorMonaco/lib/monaco-editor/min/vs/loader.js"></script>
    <script src="_content/BlazorMonaco/lib/monaco-editor/min/vs/editor/editor.main.js"></script>
    <script src="_content/MudBlazor/MudBlazor.min.js"></script>
    <script src="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.js"></script>
    <script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
    <script src="_framework/blazor.webassembly.js" autostart="false"></script>

    <script type="application/javascript">
        document.addEventListener('DOMContentLoaded', function () {
            Blazor.start({
                loadBootResource: function (type, name, defaultUri, integrity) {
                    if (defaultUri.startsWith('http'))
                        return defaultUri;
                    
                    if (!defaultUri.startsWith('/'))
                        return `/${defaultUri}`;
                    
                    return defaultUri;
                }
            });
        });
    </script>
}

<elsa-workflow-definition-editor
    remote-endpoint="https://localhost:5001/elsa/api"
    tenant-id="@Model.CompanyId"
    access-token="eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwOi8vZWxzYS5hcGkiLCJpc3MiOiJodHRwOi8vZWxzYS5hcGkiLCJleHAiOjE3MzkxOTMxODEsImlhdCI6MTczOTEwNjc4MSwibmFtZSI6ImFkbWluIiwicGVybWlzc2lvbnMiOiIqIiwicm9sZSI6IkFkbWluaXN0cmF0b3IiLCJuYmYiOjE3MzkxMDY3ODF9.kTVqFC3OHu-dqMfEuK2OTzk-CNauhgfQzQhOCU7pP8c"
    definition-id="@Model.WorkflowDefinitionId"></elsa-workflow-definition-editor>

<div id="blazor-error-ui">
    An unhandled error has occurred.
    <a href="" class="reload">Reload</a>
    <a class="dismiss">🗙</a>
</div>